import React from 'react'
import { connect } from 'react-redux'
import {Tabs} from 'antd';
const TabPane = Tabs.TabPane;
import CostCenter from 'containers/setting/cost-center/cost-center';
import CostCenterGroup from 'containers/setting/cost-center-group/cost-center-group-define';


class CityGroupInfo extends React.Component{
  constructor(props){
    super(props);
    this.state = {};
  }

  componentWillMount(){
  }

  render () {
    const {currentPageRoute, }= this.props;
    const {subFunctions}= currentPageRoute;
    return (
      <div className="full-height-page full-page-margin">
        <Tabs>
          {
            subFunctions.map(item => {
              const key = item.key;
              return (
                item.operationType !== 'H' &&
                <TabPane tab={item.resourceName} key={key}>
                  {
                    key === 'cost-center-tab' &&
                    <CostCenter onRef={(ref)=>this.costCenterRef=ref} disabled={item.operationType === "R"}/>
                  }
                  {
                    key === 'cost-center-group-define' &&
                    <CostCenterGroup  onRef={(ref)=>this.costCenterGroupRef=ref} disabled={item.operationType === "R"}/>
                  }
                </TabPane>
              )
            })
          }
        </Tabs>
      </div>
    )

  }


}
CityGroupInfo.contextTypes = {
  router: React.PropTypes.object,
};
function mapStateToProps(state) {
  return {
    currentPageRoute: state.main.currentPageRoute
  }
}

export default connect(mapStateToProps)(CityGroupInfo);
